package cn.edu.niit.server.repository;

import cn.edu.niit.server.domain.ContentInfo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;

/**
 * Spring Data SQL repository for the ContentInfo entity.
 */
@SuppressWarnings("unused")
@Repository
public interface ContentInfoRepository extends JpaRepository<ContentInfo, Long> {
    @Query("select a from ContentInfo a" + " where a.contentType.id=?1 order by a.contentTime desc")
    Page<ContentInfo> getContentInfoByType(Long typeId, Pageable pageable);

    @Query("select a from ContentInfo a " + "where a.account.login=?1 order by a.contentTime desc")
    Page<ContentInfo> getMyContent(String login, Pageable pageable);
}
